/*
 * @Author: your name
 * @Date: 2022-03-02 10:20:05
 * @LastEditTime: 2022-03-02 10:32:08
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \day03\day04\1-对象.js
 */

//对象字面量  =========创建一个对象
var person={
    weight:56,
    height:180,
    name:'zhangshan',
    sayName:function(){
        console.log('my name is ',this.name)
    }
}
//console.log(person);
console.log(person.sayName,'访问对象');
person.sayName();

//2.使用构造函数创建对象  
var obj1=new Object();  //等价于 var obj1={}
obj1.name='lisi';
obj1.age=8;
obj1.sayAge=function(){
    console.log('my age is ',this.age)
}
console.log(obj1);
obj1.sayAge()
console.log(obj1.sayAge);